home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / mac / hypercrd / hc2_x / tcprogud.sit / TC Prog Guide / card_49620.txt < prev    next >
Text File  |  1991-02-27  |  963b  |  30 lines

  1. -- card: 49620 from stack: in
  2. -- bmap block id: 0
  3. -- flags: 0000
  4. -- background id: 4755
  5. -- name: 
  6.  
  7.  
  8. -- part contents for background part 6
  9. ----- text -----
  10. 6.5  goto
  11.  
  12. -- part contents for background part 4
  13. ----- text -----
  14. The 'goto' statement allows unconditional transfer to a labeled statement.  The labelled statement must occur in the same function body (actually the same statement block).  For example:
  15.  
  16.                      .
  17.                      .
  18.     goto  begin_output;
  19.                      .
  20.                      .
  21.     begin_output:                 /* label */
  22.         printf("Here's the output:\n");
  23.                      .
  24.                      .
  25.  
  26. Goto statements and labels are almost never used since they tend to obscure program structure making debugging and maintenance difficult.  Code using goto can always be rewritten using structured programming constructs like if-else and while.
  27.  
  28. -- part contents for background part 7
  29. ----- text -----
  30. 166